<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<TITLE>::: <%=Request.Cookies("conf_compNm")%> ::::::</TITLE>
	<link href="/inc/graph/flot.css" rel="stylesheet" type="text/css">
	<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="/inc/graph/excanvas.min.js"></script><![endif]-->
	<script language="javascript" type="text/javascript" src="/inc/js/jquery-1.8.3.js"></script>
	<script language="javascript" type="text/javascript" src="/inc/graph/jquery.flot.js"></script>
	<script language = "JavaScript" src="/inc/js/common.js"></script>
	<script language = "javascript">	
		var xMode = "<%=xMode%>";
		var G_uid = "<%=Request.Cookies("S_uid")%>";
		var G_perm = "<%=Request.Cookies("S_perm")%>";
		var G_level = "<%=Request.Cookies("S_level")%>";
		var G_destFolder = "<%=Request.Cookies("S_destFolder")%>";
		<% 
			If Request.Cookies("S_level") = "50" then 
				adminShow = ""
				adminPass = "text"
			Else
				adminShow = "none"
				adminPass = "password"
			End If
		%>
	</script>
	<script type="text/javascript">
	$(function() {

		var options = {
			lines: {
				show: true
			},
			points: {
				show: true
			},
			xaxis: {
				tickDecimals: 0,
				tickSize: 1
			}
		};

		var data = [];

		$.plot("#placeholder", data, options);

		var alreadyFetched = {};

		$("button.fetchSeries").click(function () {

			var dataurl = "/action/statistics/graph.asp?xMode=txt";
				dataurl += "&type="+$("#type").val();
				dataurl += "&field="+$("#field").val();
				dataurl += "&year="+$("#year").val();
				dataurl += "&code="+$("#code").val();
				dataurl += "&section="+$("#section").val();

			function onDataReceived(series) {

				if (series.label == "reset")
				{
					data = [];
					$.plot("#placeholder", data, options);
					alreadyFetched = {};
				}
				else 
				{
					if (!alreadyFetched[series.label]) {
						alreadyFetched[series.label] = true;
						data.push(series);
					}
					$.plot("#placeholder", data, options);
				}
			}

			$.ajax({
				url: dataurl,
				type: "GET",
				dataType: "json",
				success: onDataReceived
			});
		});
		$("button.fetchSeries").click();
	});
	
	function fnDrawGraph()
	{
		$("button.fetchSeries").click();
	}
	
	function fnGoPage(dest)
	{
		location.href=dest;
	}
	
	</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td width="100%">
			<iframe id="graph" border="0" style="width:100%;height:380px;border:0" src=""></iframe>
		</td>
	</tr>
</table>
<form name="frmGraph">
	<input type="hidden" name="type" id="type" value="">
	<input type="hidden" name="field" id="field" value="">
	<input type="hidden" name="code" id="code" value="">
	<input type="hidden" name="year" id="year" value="">
	<input type="hidden" name="section" id="section" value="">
</form>

<table border="0" cellpadding="0" cellspacing="0" width="1237" style="margin-left:5px">
	<tr>
		<td width="100%" align="center" style="BORDER: #abccf8 1px solid;">
		<div class="demo-container" style="width:1200px">
			<div id="placeholder" class="demo-placeholder" style="text-align:left;width:1150px"></div>
		</div>
		</td>
	</tr>
</table>

<p>
	<button class="fetchSeries" style="display:none">First dataset</button>
</p>
<script>

	function fnChLink()
	{
		if ($.browser.version == "8.0" || $.browser.version =="7.0")
		{
			$("#graph").attr("src","statistics.asp?v=8");
		}
		else
		{
			$("#graph").attr("src","statistics.asp");
		}
	}
	fnChLink();
</script>
</body>
</html>
